<?php
/**
 * User: YL
 * Date: 2019/09/16
 */

namespace restful\traits;

trait ResourceController
{
    protected $service;

    protected function index()
    {
        $this->service->index($this->params);
    }

    protected function show(string $id)
    {
        $this->params['id'] = $id;
        $this->service->show($this->params);
    }

    protected function store()
    {
        $this->service->store($this->params);
    }

    protected function update(string $id)
    {
        $this->params['id'] = $id;
        $this->service->update($this->params);
    }

    protected function destroy(string $id)
    {
        $this->params['id'] = $id;
        $this->service->destroy($this->params);
    }
}
